/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2020-01-07 14:58:21
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 品牌查询
export const getBrands = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brands`, { params });

// 新增品牌
export const addBrand = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brands`, params);

// 修改一个品牌
export const updateBrand = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brands/${id}`, params);

// 查询品牌下拉框
// export const getBrandList = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsqueryall`, { params });
export const getBrandList = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/queryBrandDictAll`, { params });
// 条件查询车系
export const getSeries = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/seriess`, { params });

//  新增一个车系
export const addSeries = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/seriess`, params);
//  编辑一个车系
export const putSeries = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/seriess/${id}`, params);

//  条件查询车型
export const getModels = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/models`, { params });

//  新增一个车型
export const addModel = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/models`, params);
//  修改一个车型
export const editModel = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/models/${id}`, params);

//  条件查询配置配置
export const getPackages = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/packages`, { params });

//  新增一个配置
export const addPackage = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/packages`, params);
// 修改一个配置
export const editPackage = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/packages/${id}`, params);

//  查询车系 下拉框
export const getSeriesListByBrand = (id, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${id}/seriessdict`, { params });
export const getSeriesList = (brandsid, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdictAll`, { brandsid: brandsid, params: params });
//  查询车型 下拉框
// export const getModelListBySeries = (brandsid, seriessid, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdict/${seriessid}/modelsdict`, { params });
export const getModelListBySeries = (brandsid, seriessid, params) =>
  axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdictAll/${seriessid}/queryBrandDictOwner`, { params });

// 查询车系下拉框
export const getSeriesData = (brandsid, params) => axios.get(`${SERVER.BASEDATA}/series/getSeriesByBrandId?brandId=${brandsid}`, { brandsid: brandsid, params: params });
// 查询车型下拉框
export const getModelData = (brandsid, seriessid, params) =>
  axios.get(`${SERVER.BASEDATA}/dcs/vehicleProduct/brandsdict/${brandsid}/seriessdictAll/${seriessid}/modelsdictAll`, { seriessid: seriessid, params: params });
//查询车系品牌新增下拉框
export const queryBrandDictOwner = params => axios.get(`${SERVER.BASEDATA}/vehicleProduct/queryBrandDictOwner`, { params });
//新增编辑界面本店面车系下拉框
export const querySeriesDict = (brandsId, params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/brandsdict/${brandsId}/queryBrandDictOwner`, { params });

// 车厂

// 品牌查询
export const getBrandsOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brands`, { params });

// 新增品牌
export const addBrandOEM = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brands`, params);

// 修改一个品牌
export const updateBrandOEM = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brands/${id}`, params);

// 查询品牌下拉框
// export const getBrandList = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsqueryall`, { params });
export const getBrandListOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/queryBrandDictAll`, { params });
// 条件查询车系
export const getSeriesOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/seriess`, { params });

//  新增一个车系
export const addSeriesOEM = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/seriess`, params);
//  编辑一个车系
export const putSeriesOEM = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/seriess/${id}`, params);

//  条件查询车型
export const getModelsOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/models`, { params });

//  新增一个车型
export const addModelOEM = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/models`, params);
//  修改一个车型
export const editModelOEM = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/models/${id}`, params);

//  条件查询配置配置
export const getPackagesOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/packages`, { params });

//  新增一个配置
export const addPackageOEM = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/packages`, params);
// 修改一个配置
export const editPackageOEM = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/packages/${id}`, params);

//  查询车系 下拉框
export const getSeriesListByBrandOEM = (id, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brandsdict/${id}/seriessdict`, { params });
export const getSeriesListOEM = (brandsid, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brandsdict/${brandsid}/seriessdictAll`, { brandsid: brandsid, params: params });
//  查询车型 下拉框
// export const getModelListBySeries = (brandsid, seriessid, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdict/${seriessid}/modelsdict`, { params });
export const getModelListBySeriesOEM = (brandsid, seriessid, params) =>
  axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brandsdict/${brandsid}/seriessdictAll/${seriessid}/queryBrandDictOwner`, { params });

// 查询车系下拉框
export const getSeriesDataOEM = (brandsid, params) => axios.get(`${SERVER.BASEDATA}/dcs/series/getSeriesByBrandId?brandId=${brandsid}`, { brandsid: brandsid, params: params });
// 查询车型下拉框
export const getModelDataOEM = (brandsid, seriessid, params) =>
  axios.get(`${SERVER.BASEDATA}/dcs/vehicleProduct/brandsdict/${brandsid}/seriessdictAll/${seriessid}/modelsdictAll`, { seriessid: seriessid, params: params });
//查询车系品牌新增下拉框(店端)
export const queryBrandDictOwnerOEM = params => axios.get(`${SERVER.BASEDATA}/dcs/vehicleProduct/queryBrandDictOwner`, { params });
//新增编辑界面本店面车系下拉框(店端)
export const querySeriesDictOEM = (brandsId, params) => axios.get(`${SERVER.BASEDATA}/dcs/vehicleProduct/brandsdict/${brandsId}/queryBrandDictOwner`, { params });

//OEM
//条件查询选装
export const getOptionListOEM = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/options`, { params });
//  新增一个选装
export const addOptionOEM = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/options`, params);
// 修改一个选装
export const editOptionOEM = (params, id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/options/${id}`, params);

//dealer
//  条件查询配置配置
export const getOptions = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/options`, { params });
// 新增查询本店的配置信息
export const getPackageListByModel = (brandsid, seriessid, modelId, params) =>
  axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdictAll/${seriessid}/modelsdict/${modelId}/queryBrandDictOwner`, { params });
//  新增一个选装
export const addOption = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/options`, params);
// 修改一个配置
export const editOption = (params,id) => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/options/${id}`, params);

//获取经销商授权后的全部车型
export const getDealerAttachModel = (id) => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttachModel/getByIdList/${id}`);
//显示车型中文
export const getModelAllListOEM = params => axios.get(`${SERVER.BASEDATA}/dcs/vehicleProduct/brandsdict/seriessdictAll/modelsdictAll`, { params });

// 品牌导出  
export const exportBrands = params => {
    return axios({
        url: `${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/brands/export/excel`,
        method: 'get',
        params: params,
        responseType: 'blob'
    });
};
// 车系导出
export const exportSeriess = params => {
    return axios({
        url: `${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/seriess/export/excel`,
        method: 'get',
        params: params,
        responseType: 'blob'
    });
};
// 车型导出
export const exportModels = params => {
    return axios({
        url: `${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/models/export/excel`,
        method: 'get',
        params: params,
        responseType: 'blob'
    });
};
// 配置导出
export const exportpPackages = params => {
    return axios({
        url: `${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/packages/export/excel`,
        method: 'get',
        params: params,
        responseType: 'blob'
    });
};

// 选装导出
export const exportOption = params => {
    return axios({
        url: `${SERVER.DMSCLOUD_SYSBASEDATA}/dcs/vehicleProduct/options/export/excel`,
        method: 'get',
        params: params,
        responseType: 'blob'
    });
};